package com.neu.api.controller.app;


import com.neu.api.properties.JWTProperties;
import com.neu.api.service.AddressService;
import com.neu.api.utils.Result;
import com.neu.api.vo.AddressVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "地址接口")
@RestController
@RequestMapping("app/address")
@Slf4j
public class AddressController {

    Logger logger = LoggerFactory.getLogger(AddressController.class);

    @Resource
    AddressService addressService;

    @ApiOperation("查询地址接口")
    @GetMapping()
    public Result<List<AddressVO>> find(){
        logger.info("调用了find方法，查询地址");
        List<AddressVO> list = addressService.find();
        return Result.ok("成功!",list);
    }

//    @ApiOperation("添加地址接口")
//    @PostMapping("/add")
//    public Result add(addressDTO addressDTO){
//        logger.info("调用了add方法，查询地址");
//        addressService.add(addressDTO);
//        return Result.ok("注册成功!");
//    }
//
//
//    @ApiOperation("编辑地址接口")
//    @PutMapping("/{id}")
//    public Result update(@PathVariable Long id,addressDTO addressDTO){
//        logger.info("调用了update方法，编辑地址");
//        addressService.update(id,addressDTO);
//        return Result.ok("修改成功!");
//    }
//
//    @ApiOperation("删除地址接口")
//    @DeleteMapping("/{id}")
//    public Result deleteById(@PathVariable Long id){
//        logger.info("调用了deleteById方法，删除地址");
//        addressService.deleteById(id);
//        return Result.ok("删除成功!");
//    }

}
